package ca.cbc.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.log4j.Logger;

import ca.cbc.security.AuthDBConnect;

public class StackTraceToString {
	
	  private static Logger log = Logger.getLogger(StackTraceToString.class);

	public static String getStackTrace(Throwable t) {
		
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw, true);
		t.printStackTrace(pw);
		pw.flush();
		pw.close();
		sw.flush();
		String returnString = sw.toString();
		try {
			sw.close();
		} catch (IOException e) {
			log.debug(e.getMessage());
		}
		return returnString;
	}

}
